//
//  CommonMacros.h
//  Towerxi3
//
//  Created by MAC on 2020/11/13.
//

#import "FontScaleSize.h"

#ifndef CommonMacros_h
#define CommonMacros_h

/// 屏幕宽度
#define SCWidth [UIScreen mainScreen].bounds.size.width
/// 屏幕高度
#define SCHeight [UIScreen mainScreen].bounds.size.height
/// 等比缩放
#define Scale SCWidth/375.0f
/// 设备是iPad
#define IS_iPad   (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
/// 设备是iPhone
#define IS_iPhone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
/// 设备是iPhoneX
#define IS_iPhoneX SCWidth >= 375.0f && SCHeight >= 812.0f && IS_iPhone
/// 状态栏高度
#define StatusBarHeight (CGFloat)(IS_iPhoneX?(44.0):(20.0))
/// 导航栏高度
#define NavBarHeight (44)
/// 状态栏和导航栏总高度
#define NavBarAndStatusBarHeight (CGFloat)(IS_iPhoneX?(88.0):(64.0))
/// TabBar高度
#define TabBarHeight (CGFloat)(IS_iPhoneX?(49.0 + 34.0):(49.0))
/// 底部安全区域高度
#define BottomSafeHeight (CGFloat)(IS_iPhoneX?(34.0):(0))

/// 字体大小
#define FONT_SIZE(f)            [FontScaleSize systemFontOfSize:(f)]
#define FONT_BOLD_SIZE(f)       [FontScaleSize boldSystemFontOfSize:(f)]
#define FONT_ITALIC_SIZE(f)     [FontScaleSize italicSystemFontOfSize:(f)]

/// 设置颜色
#define UIColorFromHex(hex)  [hex RGBAColorWithHEXString]

#define RGBColor(r,g,b)         [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1]
#define RGBAColor(r,g,b,a)      [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]

#endif /* CommonMacros_h */
